<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>惠农网 - 留言</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css" />
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/my.css" />
</head>
<body>
<div class="container">
    <%@include file="common/header.jsp"%>
    <div class="row upDown">
        <%--左侧--%>
        <div class="col-2">
            <%@include file="common/product-class.jsp"%>
            <%@include file="common/last-view.jsp"%>
        </div>
        <%--中部--%>
        <div class="col-10">
            <%--展示商品列表--%>
            <div class="row">
                <%--留言展示--%>
                <div class="row w-100">
                    <h5>全部留言</h5>
                </div>
                <div class="row w-100">
                    <div class="list-group w-100">
                        <c:forEach items="${ebcomments}" var="comment">
                            <div href="#" class="list-group-item list-group-item-action flex-column align-items-start w-100">
                                <div class="d-flex w-100 justify-content-between">
                                    <h5 class="mb-1">${comment.ecContent}</h5>
                                    <small>网友：${comment.ecNickName} </small>
                                </div>
                                <p class="mb-1">${comment.ecReply}</p>
                                <small>${comment.ecCreateTime}</small>
                            </div>
                        </c:forEach>
                    </div>
                </div>
            </div>
            <%--分页--%>
            <div class="row float-right">
                <nav aria-label="Page navigation example" class="float-right">
                    <ul class="pagination">
                        <li class="page-item">
                            <a class="page-link" href="${pageContext.request.contextPath}/comment/list?page=${currPage>1?currPage-1:1}" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                                <span class="sr-only">Previous</span>
                            </a>
                        </li>
                        <c:forEach var="i" begin="${currPage>3?currPage-3:1}" end="${(totalPage-currPage)>3?currPage+3:totalPage}" step="1">
                            <li <c:if test="${i==currPage}"> class="page-item active" </c:if> <c:if test="${i!=currPage}"> class="page-item" </c:if>>
                                <a class="page-link" href="${pageContext.request.contextPath}/comment/list?page=${i}">${i}</a>
                            </li>
                        </c:forEach>
                        <li class="page-item">
                            <a class="page-link" href="${pageContext.request.contextPath}/comment/list?page=${currPage<totalPage?currPage+1:totalPage}" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                                <span class="sr-only">Next</span>
                            </a>
                        </li>
                        <li style="line-height: 38px" class="align-middle">共${totalPage}页</li>
                    </ul>
                </nav>
            </div>
            <%--富文本编辑器--%>
            <div id="reply-box" class="w-100">
                <iframe src="${pageContext.request.contextPath}/f-comment/to-save" width="100%" height="300" style="border:none;"></iframe>
            </div>
        </div>

    </div>
    <div class="row text-center">
        <%@include file="common/footer.jsp"%>
    </div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/popper.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/bootstrap.min.js"></script>
</body>
</html>